package com.zr.flink.thread;


import com.example.klinemqflink.model.MarketData;
import com.example.klinemqflink.utils.LocalTimeUtil;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.time.Instant;

@Service
public class DataProcessor {
    private  String threadName;
    private MarketData marketData;


    public void processor() {
        // 获取当前时间
        Instant now = Instant.now();
        // 将当前时间转换为微秒
        long micros = now.toEpochMilli() * 1000; // 先转换为毫秒，再乘以1000得到微秒
        System.out.println(threadName+"---"+micros);
        System.out.println(LocalTimeUtil.timestampToDateTime(this.marketData.getTimestamp()));
    }

    public void setThreadName(String threadName) {
        this.threadName = threadName;
    }

    public void setMarketData(MarketData marketData) {
        this.marketData = marketData;
    }
}
